package cn.bgs.controller;


import cn.bgs.page.PageRequest;
import cn.bgs.pojo.Maintenances;
import cn.bgs.service.RepairService;
import cn.bgs.utils.R;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/Repair")
public class RepairController {
    @Autowired
    private RepairService repairService;

    //删除方法
    @GetMapping("/repairDelect")
    public R repairDelect(Integer maintenanceId){
        return repairService.repairDelect(maintenanceId);
    }
    //分页方法
    @GetMapping("/repairSelect")
    public PageInfo<Maintenances> repairSelect(PageRequest pageRequest,String owner){
        PageInfo<Maintenances> allUser = repairService.repairSelect(pageRequest,owner);
        return allUser;
    }
    @PostMapping("/repairAdd")
    public R repairAdd(@RequestBody Maintenances maintenances){
        return repairService.repairAdd(maintenances);
    }
    @PostMapping("/repairUpdate")
    public R repairUpdate(@RequestBody Maintenances maintenances){
        return repairService.repairUpdate(maintenances);
    }

}
